package com.gitee.wsl.collections.set

import kotlin.test.Test
import kotlin.test.assertEquals

class ListOrderedSetTest {
    @Test
    fun testDuplicates() {
        val list = ArrayList<Int>(10)
        list.add(1)
        list.add(2)
        list.add(3)
        list.add(1)

        val orderedSet = ListOrderedSet.listOrderedSet(list)

        assertEquals(3, orderedSet.size)
        //assertEquals(3, orderedSet.iterator())

        // insertion order preserved?
        assertEquals(1, orderedSet.get(0))
        assertEquals(2, orderedSet.get(1))
        assertEquals(3, orderedSet.get(2))
    }

}